package com.bea.ftd.dashboard.validator;

import org.springframework.stereotype.Component;

@Component
public class BooleanValidator {

	/**
	 * 验证传入的数字是否为0和1，0代表false,1代表true
	 * 
	 * @param val
	 * @return
	 */
	public boolean isBooleanType(Integer val) {
		if (null == val) {
			return false;

		}

		if (!(val == 0 || val == 1)) {
			return false;
		}

		return true;
	}

	/**
	 * 验证传入的数字是否为0和1，0代表false,1代表true
	 * 
	 * @param val
	 * @return
	 */
	public boolean isBooleanType(Long val) {
		if (null == val) {
			return false;

		}

		if (!(val == 0 || val == 1)) {
			return false;
		}

		return true;
	}
}
